home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
hard
/
drivr
/
ibmk.lha
/
ibmk
/
a51.doc
< prev
next >
Wrap
Text File
|
1992-08-20
|
3KB
|
74 lines
This is an 8031/8051 assembler.
This assembler is a simple one, I think. It includes little error checking
but it does work on programs that are correctly written. It will bomb out
of assembling on any error. Usually when compling programs anyhow, the
rest of the errors are useless anyhow. It is not "case sensative".
This assembler has several directives:
.org exp ;start address at exp.
.equ exp,exp ;equate left expression to right one.
.db exp ;define byte of expression
.dw exp ;define word.
.rs exp ;reserve exp bytes of space
.dm exp ;define message. Put in single quotes.
.end exp ;end assembly. Start address=exp
"exp" is either a string constant or a number, or a math function of both.
Either way, the resulting expression must be a constant. I.e. No registers.
Is that clear? (I am not good at documentation!)
string names, called "tags" can be up to 80 characters in length, but each
line can ONLY be 80 characters long, so it's probably best to make them a
little shorter than 80.
This compiler supports addition, subtraction, and multiplication of
constants. Plus, any character within single quotes will be treated as the
ASCII decimal equivalent. I.e. 'A'=65.
numerical constants can be specified in one of three ways, not including the
character constant. Decimal, Hexidecimal, and Binary are all supported.
Both H'xxx and 0xxxH and B'xxx and 0xxxB are supported. My favorite is 0xxxH.
If the trailing H is used in hexidecimal format, like most compilers, if the
first number is a alphabet character (A-F) it must be preceded with a 0.
The full 8051 instruction set it translated in this assembler EXCEPT for
1. ANL c,/bit and 2. ORL c,/bit. Oh well!
To use this assembler, first compile it with "cc a51.c -o a51"
The compiler must be able to handle arrays of 32k long. With this capability,
you can have programs with an ADDRESS SPACE OF 0-8000 HEX! Addresses
farther than this will cause the program to BOMB. If your compiler can
handle it, change the array bounds in a51.h to 64k and all limiting
references to 32k in the program to 64k. I can't imagine a 32k program on
the 8051 myself...
To use the program, type "a51 filename" The assembler will generate two
files, a filename.lst file and a filename.hex file.
The .lst file will contain a listing of your program with the code
beside it followed by a table of tags that were defined.
The .hex file will contain all the object code that is in your program
but no checksums, since I don't know how to do that. (any ideas?)
To make life easy, the assembler comes with an additional file, "a51.equ"
that has predefined tags with thier values. This file must end with a negative
number as a delimiter. Feel free to add your own equates if you want. It will
work the same.
Negative numbers are treated as two's complement. Always. If the number is
negative and greater than -256, it is treated as a byte.
If the number is negative and less than -255 (like -256) it is treated as
a word. Remember this! It's probably best not even to use negative
constants. Figure them out yourself and compliment them. Just to make sure,
check the code listing and see if it's right.
rem statements are preceded by semicolons.
Example programs foo and foo2 are included to show a couple of the features.
Questions? Complaints? Bugs?
Eric Rudolph (503-745-5794)